﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using FluorineFx;
using System.Collections;
using System.Data;

namespace Htxw.AMFRemoting
{
    /// <summary>
    /// HT的函数集合
    /// </summary>
    public class HtFunction
    {
        //-----------------------------------------------------------------------------------------------
        /// <summary>
        /// MD5加密
        /// </summary>
        /// <param name="str">加密源</param>
        /// <param name="code">加密位数</param>
        /// <returns></returns>
        public static string GetMd5(string str, int code)
        {
            // ReSharper disable PossibleNullReferenceException
            return code == 16
                ? System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower().Substring(8, 16)
                : System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower();
            // ReSharper restore PossibleNullReferenceException
        }

    }
}